<?php

namespace common\models\common;

use Yii;

/**
 * This is the model class for collection "jg_common_log".
 *
 * @property \MongoDB\BSON\ObjectID|string $_id
 * @property mixed $app_id
 * @property mixed $user_id
 * @property mixed $realname
 * @property mixed $role
 * @property mixed $method
 * @property mixed $module
 * @property mixed $controller
 * @property mixed $action
 * @property mixed $url
 * @property mixed $get_data
 * @property mixed $post_data
 * @property mixed $header_data
 * @property mixed $ip
 * @property mixed $error_code
 * @property mixed $error_msg
 * @property mixed $error_data
 * @property mixed $req_id
 * @property mixed $device
 * @property mixed $system
 * @property mixed $terminal
 * @property mixed $serial_no
 * @property mixed $content
 * @property mixed $status
 * @property mixed $created_at
 * @property mixed $updated_at
 * @property mixed $project_id
 */
class Log extends \yii\mongodb\ActiveRecord
{
    /**
     * {@inheritdoc}
     */

    public static function collectionName()
    {
      return  Yii::$app->params['user.mongodb.log'];
    //    return ['baiyou_dev_logs', 'by_common_log'];
    }

    const STATUS_NORMAL = 1; // 正常
    const STATUS_ABNORMAL =2; // 异常



    /**
     * {@inheritdoc}
     */
    public function attributes()
    {
        return [
            '_id',
            'serial_no',
            'app_id',
            'user_id',
            'realname',
            'role',
            'method',
            'module',
            'system',
            'terminal',
            'controller',
            'action',
            'url',
            'get_data',
            'post_data',
            'header_data',
            'ip',
            'error_code',
            'error_msg',
            'error_data',
            'req_id',
            'device',
            'status',
            'content',
            'created_at',
            'updated_at',
            'project_id',
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['app_id', 'user_id', 'method', 'module', 'controller', 'action', 'url', 'get_data', 'post_data', 'header_data', 'ip', 'error_code', 'error_msg', 'error_data', 'req_id', 'device', 'status', 'created_at', 'updated_at'], 'safe']
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            '_id' => 'ID',
            'app_id' => 'App ID',
            'user_id' => 'User ID',
            'method' => 'Method',
            'module' => 'Module',
            'controller' => 'Controller',
            'action' => 'Action',
            'url' => 'Url',
            'get_data' => 'Get Data',
            'post_data' => 'Post Data',
            'header_data' => 'Header Data',
            'ip' => 'Ip',
            'error_code' => 'Error Code',
            'error_msg' => 'Error Msg',
            'error_data' => 'Error Data',
            'req_id' => 'Req ID',
            'device' => 'Device',
            'status' => 'Status',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }
}
